package com.spi.controller;

import org.redisson.api.RLock;
import org.redisson.api.RedissonClient;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.data.redis.core.RedisTemplate;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import javax.annotation.Resource;

@RequestMapping("/redis")
@RestController
public class RedissController {

    @Autowired
    private RedisTemplate redisTemplate ;
    @Resource
    private RedissonClient redissonClient ;

    @RequestMapping("/test")
    public String test(){
        System.out.println("进来了。。。");
        //redisTemplate.opsForValue().set("aa",1);
        RLock abc = redissonClient.getLock("abc");
        System.out.println(abc);
        return "redis test";
    }
}
